Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prefer symbols over strings as indeterminants #4158

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

lgoettgens
Copy link
Member

@lgoettgens lgoettgens commented Sep 27, 2024

@lkastner @HereAround could you have a look if the attributes coordinate_names and coordinate_names_of_torus in the toric varieties could be changed to Vector{Symbol} instead of Vector{String} to reduce the allocations from copying this around and passing it to polynomial_ring etc? (moved to #4159)

@lgoettgens
Copy link
Member Author

@benlorenz is this failure something similar to what you work around in #4153 or is a genuine failure?

alternative inputs: Test Failed at /Users/aaruni/Desktop/oscar-runners/runner-1/_work/Oscar.jl/Oscar.jl/test/PolyhedralGeometry/subdivision_of_points.jl:17
 Expression: collect(maximal_cells(square_by_incidence)) == collect(maximal_cells(square_by_weights))
 Evaluated: [[1, 2, 3], [2, 3, 4]] == [[2, 3, 4], [1, 2, 3]]

https://github.com/oscar-system/Oscar.jl/actions/runs/11072577996/job/30767135768?pr=4158#step:9:1856

@@ -61,7 +61,7 @@ function global_tate_model(base::NormalToricVariety,
vs2 = collect(keys(defining_section_parametrization))
@req all(in(["a1", "a2", "a3", "a4", "a6"]), vs2) "Only the Tate sections a1, a2, a3, a4, a6 must be parametrized"

gens_base_names = [string(g) for g in gens(cox_ring(base))]
gens_base_names = [string(g) for g in symbols(cox_ring(base))]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@HereAround pinging you to make you aware that symbols(::MPolyRing) exists. In many of these cases you probably don't even need to convert to strings afterwards, but I kept it like this if I didn't see an obvious way to change the below code

@benlorenz
Copy link
Member

@benlorenz is this failure something similar to what you work around in #4153 or is a genuine failure?

alternative inputs: Test Failed at /Users/aaruni/Desktop/oscar-runners/runner-1/_work/Oscar.jl/Oscar.jl/test/PolyhedralGeometry/subdivision_of_points.jl:17
 Expression: collect(maximal_cells(square_by_incidence)) == collect(maximal_cells(square_by_weights))
 Evaluated: [[1, 2, 3], [2, 3, 4]] == [[2, 3, 4], [1, 2, 3]]

oscar-system/Oscar.jl/actions/runs/11072577996/job/30767135768?pr=4158#step:9:1856

I only noticed (and now fixed) those in polyhedron.jl so far but this is similar and I will do another PR soon.

@test collect(maximal_cells(square_by_incidence)) ==
collect(maximal_cells(square_by_weights))
@test issetequal(collect(maximal_cells(square_by_incidence)),
collect(maximal_cells(square_by_weights)))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@benlorenz I added this already here to try to get CI green eventually

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, thanks! The collect should be unnecessary now but I can take care of that later.
For the cases in polyhedron.jl a rerun usually fixed it.

@lgoettgens lgoettgens force-pushed the lg/prefer-symbols branch 2 times, most recently from 0784fd0 to ef891b7 Compare September 27, 2024 16:20
Copy link
Collaborator

@afkafkafk13 afkafkafk13 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Algebraic Geometry/Commutative Algebra part looks good provided tests pass -- with the exception that I did not look at toric stuff (because you already pinged @HereAround ) and IntersectionTheory should be pinged as well.

@lgoettgens lgoettgens added the optimization Simpler/more performant code or more/better tests label Sep 30, 2024
Copy link

codecov bot commented Sep 30, 2024

Codecov Report

Attention: Patch coverage is 93.84615% with 4 lines in your changes missing coverage. Please review.

Project coverage is 84.70%. Comparing base (32a38b3) to head (f3d075e).
Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
experimental/FTheoryTools/src/auxiliary.jl 81.81% 2 Missing ⚠️
experimental/IntersectionTheory/src/Bott.jl 50.00% 1 Missing ⚠️
...metricIntersections/src/symmetric_grassmannians.jl 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4158      +/-   ##
==========================================
- Coverage   84.70%   84.70%   -0.01%     
==========================================
  Files         628      628              
  Lines       84449    84447       -2     
==========================================
- Hits        71529    71527       -2     
  Misses      12920    12920              
Files with missing lines Coverage Δ
...rimental/BasisLieHighestWeight/src/WeylPolytope.jl 100.00% <100.00%> (ø)
.../FTheoryTools/src/AbstractFTheoryModels/methods.jl 78.27% <100.00%> (ø)
...TheoryTools/src/HypersurfaceModels/constructors.jl 96.72% <100.00%> (ø)
...tal/FTheoryTools/src/HypersurfaceModels/methods.jl 100.00% <100.00%> (ø)
.../FTheoryTools/src/LiteratureModels/constructors.jl 93.81% <100.00%> (ø)
...mental/FTheoryTools/src/TateModels/constructors.jl 97.46% <100.00%> (ø)
...xperimental/FTheoryTools/src/TateModels/methods.jl 66.29% <100.00%> (ø)
...FTheoryTools/src/WeierstrassModels/constructors.jl 95.65% <100.00%> (ø)
...ntal/FTheoryTools/src/WeierstrassModels/methods.jl 100.00% <100.00%> (ø)
...erimental/FTheoryTools/test/hypersurface_models.jl 100.00% <ø> (ø)
... and 29 more

... and 2 files with indirect coverage changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
optimization Simpler/more performant code or more/better tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants